package com.csun.nusing.ui.activity;

import android.content.Intent;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.LinearLayout;

import com.csun.nusing.R;
import com.csun.nusing.presenter.DeviceListPresenter;
import com.csun.nusing.presenter.inter.IBase;
import com.csun.nusing.ui.BaseActivity;
import com.videogo.VideoListActivity;

/**
 * 设备的列表界面 ClassName: DeviceListActivity
 * 
 * @Description: TODO
 * @author fzq
 * @date 2017-10-25
 */
public class DeviceListActivity extends BaseActivity<DeviceListPresenter>
		implements IBase {

	private LinearLayout followll;
	private LinearLayout alarmll;
	private LinearLayout watchll;
	private LinearLayout sleepll;
	private LinearLayout videoll;

	@Override
	public int getContentViewId() {
		return R.layout.activity_nursing_deviceist;
	}

	@Override
	public void initSubViews(View view) {
		super.initSubViews(view);
		findView();
		controlView();
	}

	/**
	 * 初始控件
	 * 
	 * @Description: TODO
	 * @param
	 * @return void
	 * @throws
	 * @author fzq
	 * @date 2017-10-23
	 */
	private void findView() {
		followll = findViewById(R.id.nursing_alldevice_follow_ll);
		alarmll = findViewById(R.id.nursing_alldevice_alarm_ll);
		watchll = findViewById(R.id.nursing_alldevice_watch_ll);
		sleepll = findViewById(R.id.nursing_alldevice_sleep_ll);
		videoll = findViewById(R.id.nursing_alldevice_video_ll);
	}

	/**
	 * 点击时间 ClassName: click
	 * 
	 * @Description: TODO
	 * @author fzq
	 * @date 2017-11-3
	 */
	private class click implements OnClickListener {

		@Override
		public void onClick(View v) {
			Intent intent = new Intent(DeviceListActivity.this,
					AllDeviceActivity.class);
			switch (v.getId()) {
			case R.id.nursing_alldevice_follow_ll:
				intent.putExtra("type", "0");
				startActivity(intent);
				break;
			case R.id.nursing_alldevice_alarm_ll:
				intent.putExtra("type", "3");
				startActivity(intent);
				break;
			case R.id.nursing_alldevice_watch_ll:
				intent.putExtra("type", "1");
				startActivity(intent);
				break;
			case R.id.nursing_alldevice_sleep_ll:
				intent.putExtra("type", "2");
				startActivity(intent);
				break;
			case R.id.nursing_alldevice_video_ll:
				 intent = new Intent(DeviceListActivity.this, VideoListActivity.class);
				 startActivity(intent);
				break;
			}
		}

	}

	@Override
	public void initData() {
		super.initData();

	}

	/**
	 * 控制view的事件
	 * 
	 * @Description: TODO
	 * @param
	 * @return void
	 * @throws
	 * @author fzq
	 * @date 2017-10-24
	 */
	private void controlView() {
		followll.setOnClickListener(new click());
		alarmll.setOnClickListener(new click());
		watchll.setOnClickListener(new click());
		sleepll.setOnClickListener(new click());
		videoll.setOnClickListener(new click());
	}

}
